<%@ Page Language="C#" MasterPageFile="~/Admin/AdminMasterPage.master" EnableEventValidation="false" ValidateRequest="false" AutoEventWireup="true" CodeFile="EditCategory.aspx.cs" Inherits="Admin_EditCategory" Title="Untitled Page" %>

<%@ Register Assembly="FreeTextBox" Namespace="FreeTextBoxControls" TagPrefix="FTB" %>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderAdmin" Runat="Server">
        
<b>Choose WareHouse :</b>
<br />
<br />

<asp:DropDownList ID="ddlstWareHouse" runat="server" DataSourceID="ObjectDataSourceWareHouse" DataTextField="WarehouseName" DataValueField="WarehouseID" Width="190px" AutoPostBack="True" />
    <br />
    <br />   
    <b>Choose Category :</b>
    <br />
    <br />
    <asp:DropDownList ID="ddlstCategory" runat="server" DataSourceID="ObjectDataSourceCategory" DataTextField="CategoryName" DataValueField="CategoryID" Width="190px" AutoPostBack="True" />
    <br />    
    <br />

    <b>Edit Category :</b>
    <br />
    
    <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
        DataSourceID="ObjectDataSourceEdit" Height="50px" Width="600px" OnItemUpdated="DetailsView1_ItemUpdated" CellSpacing="10" GridLines="None">
        <Fields>
            <asp:BoundField DataField="CategoryID" HeaderText="CategoryID" SortExpression="CategoryID" ReadOnly="True" >
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="WareHouseID" HeaderText="WareHouseID" SortExpression="WareHouseID" >
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" >
                <ItemStyle HorizontalAlign="Center" />
            </asp:BoundField>
            <asp:TemplateField HeaderText="Description" SortExpression="Description">
                <EditItemTemplate>                    
                    <FTB:FreeTextBox ID="FreeTextBox1" runat="server" ButtonSet="OfficeMac" Text='<%# Bind("Description") %>' Width="590px">
                    </FTB:FreeTextBox>
                </EditItemTemplate>
                <InsertItemTemplate>
                    <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("Description") %>'></asp:TextBox>
                </InsertItemTemplate>
                <ItemTemplate>
                    <asp:Label ID="Label1" runat="server" Text='<%# Bind("Description") %>'></asp:Label>
                </ItemTemplate>
                <ItemStyle Width="600px" />
            </asp:TemplateField>
            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" ButtonType="Button" >
                <ItemStyle HorizontalAlign="Center" />
            </asp:CommandField>
        </Fields>
    </asp:DetailsView>
    
    <asp:ObjectDataSource ID="ObjectDataSourceWareHouse" runat="server" SelectMethod="GetAll"
        TypeName="Bll.WareHouseBll"></asp:ObjectDataSource>
    
    <asp:ObjectDataSource ID="ObjectDataSourceCategory" runat="server" SelectMethod="GetByWareHouseID" TypeName="Bll.CategoryBll">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddlstWareHouse" Name="wareHouseID" PropertyName="SelectedValue"
                Type="String" />
        </SelectParameters>        
    </asp:ObjectDataSource>
    
    <asp:ObjectDataSource ID="ObjectDataSourceEdit" runat="server" DataObjectTypeName="Entities.CategoryInfo"
        DeleteMethod="Delete" InsertMethod="Insert" SelectMethod="GetByID" TypeName="Bll.CategoryBll"
        UpdateMethod="Update">
        <SelectParameters>
            <asp:ControlParameter ControlID="ddlstCategory" Name="categoryID" PropertyName="SelectedValue"
                Type="String" />
        </SelectParameters>
    </asp:ObjectDataSource>       
        
</asp:Content>

